#include <ros/ros.h>
#include <sensor_msgs/LaserScan.h>

ros::Publisher pub;
sensor_msgs::LaserScan scanout;

const int n = 700;

void scan_cb(const sensor_msgs::LaserScan::ConstPtr& scan)
{
  scanout.header.stamp = ros::Time::now();
  scanout.header.seq = scan->header.seq;
  scanout.time_increment = scan->time_increment;
  scanout.angle_min = scan->angle_min; scanout.angle_max = scan->angle_max;
  scanout.angle_increment = scan->angle_increment; scanout.time_increment = scan->time_increment;
  scanout.scan_time = scan->scan_time;
  scanout.range_min = scan->range_min; scanout.range_max = scan->range_max;
  scanout.header.frame_id = "/laser";

  for(int i=0; i <n; i++)
  {
	scanout.ranges[i] = scan->ranges[i];
  }

  pub.publish(scanout);
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "legfinder"); 
  ros::NodeHandle nh;

  scanout.ranges.resize(n);

  pub = nh.advertise<sensor_msgs::LaserScan>("scan_throttle", 1);
  ros::Subscriber sub = nh.subscribe("scan3", 1, scan_cb);

  ros::spin();
  return 0;
}
